package com.zl.controller;

import com.zl.domain.Order;
import com.zl.feign.UserOrderFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author zl
 * @date 2023/3/19
 * @apiNote
 */
@RestController
public class UserController {

    @Autowired
    private UserOrderFeign userOrderFeign;

    @GetMapping("/userDoOrder")
    public String UserDoOrder(){
        System.out.println("有客户来了");
        String s = userOrderFeign.doOrder();
        return s;
    }

    @GetMapping("testParam")
    public String testParam() {
        String zzz = userOrderFeign.testUrl("zzz", 18);
        System.out.println(zzz);

        String oneParam = userOrderFeign.oneParam("小李");
        System.out.println(oneParam);

        String twoParam = userOrderFeign.twoParam("小赵", 19);
        System.out.println(twoParam);

        Order zl = Order.builder()
                .id(1)
                .name("zl")
                .price(18)
                .date(new Date())
                .build();
        String oneObject = userOrderFeign.oneObject(zl);
        System.out.println(oneObject);

        String oneObjectParam = userOrderFeign.oneObjectParam(zl, "小小赵");
        System.out.println(oneObjectParam);


        return "success";

    }
}
